home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
dev
/
obero
/
oberon_lib.lha
/
oberon-a
/
source1.lha
/
source
/
Amiga
/
Locale.mod
< prev
next >
Wrap
Text File
|
1994-08-08
|
15KB
|
476 lines
(*************************************************************************
$RCSfile: Locale.mod $
Description: Interface to locale.library
Created by: fjc (Frank Copeland)
$Revision: 3.1 $
$Author: fjc $
$Date: 1994/08/08 01:19:07 $
Includes Release 40.15
(C) Copyright 1991-1993 Commodore-Amiga, Inc.
All Rights Reserved
Oberon-A Interface Copyright © 1994, Frank Copeland.
This file is part of the Oberon-A Interface.
See Oberon-A.doc for conditions of use and distribution.
Log entries are at the end of the file.
*************************************************************************)
MODULE Locale;
(*
** $C- CaseChk $I- IndexChk $L+ LongAdr $N- NilChk
** $P- PortableCode $R- RangeChk $S- StackChk $T- TypeChk
** $V- OvflChk $Z- ZeroVars
*)
IMPORT
E := Exec,
U := Utility,
D := Dos,
Rx := Rexx,
SYS := SYSTEM;
(*
** $VER: locale.h 38.12 (24.2.93)
**
** locale.library interface structures and definitions
*)
(*****************************************************************************)
CONST
(* constants for GetLocaleStr() *)
day1 * = 1; (* Sunday *)
day2 * = 2; (* Monday *)
day3 * = 3; (* Tuesday *)
day4 * = 4; (* Wednesday *)
day5 * = 5; (* Thursday *)
day6 * = 6; (* Friday *)
day7 * = 7; (* Saturday *)
abday1 * = 8; (* Sun *)
abday2 * = 9; (* Mon *)
abday3 * = 10; (* Tue *)
abday4 * = 11; (* Wed *)
abday5 * = 12; (* Thu *)
abday6 * = 13; (* Fri *)
abday7 * = 14; (* Sat *)
mon1 * = 15; (* January *)
mon2 * = 16; (* February *)
mon3 * = 17; (* March *)
mon4 * = 18; (* April *)
mon5 * = 19; (* May *)
mon6 * = 20; (* June *)
mon7 * = 21; (* July *)
mon8 * = 22; (* August *)
mon9 * = 23; (* September *)
mon10 * = 24; (* October *)
mon11 * = 25; (* November *)
mon12 * = 26; (* December *)
abmon1 * = 27; (* Jan *)
abmon2 * = 28; (* Feb *)
abmon3 * = 29; (* Mar *)
abmon4 * = 30; (* Apr *)
abmon5 * = 31; (* May *)
abmon6 * = 32; (* Jun *)
abmon7 * = 33; (* Jul *)
abmon8 * = 34; (* Aug *)
abmon9 * = 35; (* Sep *)
abmon10 * = 36; (* Oct *)
abmon11 * = 37; (* Nov *)
abmon12 * = 38; (* Dec *)
yesStr * = 39; (* affirmative response for yes/no queries *)
noStr * = 40; (* negative response for yes/no queries *)
amStr * = 41; (* AM *)
pmStr * = 42; (* PM *)
softHyphen * = 43; (* soft hyphenation *)
hardHyphen * = 44; (* hard hyphenation *)
openQuote * = 45; (* start of quoted block *)
closeQuote * = 46; (* end of quoted block *)
yesterdayStr * = 47; (* Yesterday *)
todayStr * = 48; (* Today *)
tomorrowStr * = 49; (* Tomorrow *)
futureStr * = 50; (* Future *)
maxStrMsg * = 51; (* current number of defined strings *)
(*****************************************************************************)
TYPE
(* OpenLibrary("locale.library",0) returns a pointer to this structure *)
LocaleBasePtr* = CPOINTER TO LocaleBase;
LocaleBase * = RECORD (E.Library)
sysPatches * : E.BOOL; (* TRUE if locale installed its patches *)
END;
(*****************************************************************************)
TYPE
(* This structure must only be allocated by locale.library and is READ-ONLY! *)
LocalePtr * = CPOINTER TO Locale;
Locale * = RECORD
localeName - : E.STRPTR; (* locale's name *)
languageName - : E.STRPTR; (* language of this locale *)
prefLanguages - : ARRAY 10 OF E.STRPTR; (* preferred languages*)
flags - : E.ULONG; (* always 0 for now *)
codeSet - : E.ULONG; (* always 0 for now *)
countryCode - : E.ULONG; (* user's country code *)
telephoneCode - : E.ULONG; (* country's telephone code *)
gmtOffset - : LONGINT; (* minutes from GMT *)
measuringSystem - : E.UBYTE; (* what measuring system? *)
calendarType - : E.UBYTE; (* what calendar type? *)
reserved0 - : ARRAY 2 OF E.UBYTE;
dateTimeFormat - : E.STRPTR; (* regular date & time format *)
dateFormat - : E.STRPTR; (* date format by itself *)
timeFormat - : E.STRPTR; (* time format by itself *)
shortDateTimeFormat - : E.STRPTR; (* short date & time format *)
shortDateFormat - : E.STRPTR; (* short date format by itself *)
shortTimeFormat - : E.STRPTR; (* short time format by itself *)
(* for numeric values *)
decimalPoint - : E.STRPTR; (* character before the decimals *)
groupSeparator - : E.STRPTR; (* separates groups of digits *)
fracGroupSeparator - : E.STRPTR; (* separates groups of digits *)
grouping - : E.APTR; (* size of each group *)
fracGrouping - : E.APTR; (* size of each group *)
(* for monetary values *)
monDecimalPoint - : E.STRPTR;
monGroupSeparator - : E.STRPTR;
monFracGroupSeparator - : E.STRPTR;
monGrouping - : E.APTR;
monFracGrouping - : E.APTR;
monFracDigits - : E.UBYTE; (* digits after the decimal point *)
monIntFracDigits - : E.UBYTE; (* for international representation *)
reserved1 - : ARRAY 2 OF E.UBYTE;
(* for currency symbols *)
monCS - : E.STRPTR; (* currency symbol *)
monSmallCS - : E.STRPTR; (* symbol for small amounts *)
monIntCS - : E.STRPTR; (* internationl (ISO 4217) code *)
(* for positive monetary values *)
monPositiveSign - : E.STRPTR; (* indicate positive money value *)
monPositiveSpaceSep - : E.UBYTE; (* determine if separated by space *)
monPositiveSignPos - : E.UBYTE; (* position of positive sign *)
monPositiveCSPos - : E.UBYTE; (* position of currency symbol *)
reserved2 - : E.UBYTE;
(* for negative monetary values *)
monNegativeSign - : E.STRPTR; (* indicate negative money value *)
monNegativeSpaceSep - : E.UBYTE; (* determine if separated by space *)
monNegativeSignPos - : E.UBYTE; (* position of negative sign *)
monNegativeCSPos - : E.UBYTE; (* position of currency symbol *)
reserved3 - : E.UBYTE;
END;
CONST
(* constants for Locale.loc_MeasuringSystem *)
msISO * = 0; (* international metric system *)
msAmerican * = 1; (* american system *)
msImperial * = 2; (* imperial system *)
msBritish * = 3; (* british system *)
(* constants for Locale.loc_CalendarType *)
ct7Sun * = 0; (* 7 days a week, Sunday is the first day *)
ct7Mon * = 1; (* 7 days a week, Monday is the first day *)
ct7Tue * = 2; (* 7 days a week, Tuesday is the first day *)
ct7Wed * = 3; (* 7 days a week, Wednesday is the first day *)
ct7Thu * = 4; (* 7 days a week, Thursday is the first day *)
ct7Fri * = 5; (* 7 days a week, Friday is the first day *)
ct7Sat * = 6; (* 7 days a week, Saturday is the first day *)
(* constants for Locale.loc_MonPositiveSpaceSep and Locale.loc_MonNegativeSpaceSep *)
ssNoSpace * = 0; (* cur. symbol is NOT separated from value with a space *)
ssSpace * = 1; (* cur. symbol IS separated from value with a space *)
(* constants for Locale.loc_MonPositiveSignPos and Locale.loc_MonNegativeSignPos *)
spParens * = 0; (* () surround the quantity and currency_symbol *)
spPrecAll * = 1; (* sign string comes before amount and symbol *)
spSuccAll * = 2; (* sign string comes after amount and symbol *)
spPrecCurr * = 3; (* sign string comes right before currency symbol *)
spSuccCurr * = 4; (* sign string comes right after currency symbol *)
(* constants for Locale.loc_MonPositiveCSPos and Locale.loc_MonNegativeCSPos *)
cspPrecedes * = 0; (* currency symbol comes before value *)
cspSucceeds * = 1; (* currency symbol comes after value *)
(* elements of the byte arrays pointed to by:
* Locale.loc_Grouping
* Locale.loc_FracGrouping
* Locale.loc_MonGrouping
* Locale.loc_MonFracGrouping
* are interpreted as follows:
*
* 255 indicates that no further grouping is to be performed
* 0 indicates that the previous element is to be repeatedly used
* for the remainder of the digits
* <other> the number of digits that comprises the current group
*)
(*****************************************************************************)
CONST
(* Tags for OpenCatalog() *)
ocTagBase * = U.tagUser + 090000H;
ocBuiltInLanguage * = ocTagBase+1; (* language of built-in strings *)
ocBuiltInCodeSet * = ocTagBase+2; (* code set of built-in strings *)
ocVersion * = ocTagBase+3; (* catalog version number required *)
ocLanguage * = ocTagBase+4; (* preferred language of catalog *)
(*****************************************************************************)
CONST
(* Comparison types for StrnCmp() *)
scAscii * = 0;
scCollate1 * = 1;
scCollate2 * = 2;
(*****************************************************************************)
TYPE
(* This structure must only be allocated by locale.library and is READ-ONLY! *)
CatalogPtr * = CPOINTER TO Catalog;
Catalog * = RECORD (E.Node) (* for internal linkage *)
pad - : E.UWORD; (* to longword align *)
language - : E.STRPTR; (* language of the catalog *)
codeSet - : E.ULONG; (* currently always 0 *)
version - : E.UWORD; (* version of the catalog *)
revision - : E.UWORD; (* revision of the catalog *)
END;
(*-- Library Base variable --------------------------------------------*)
CONST
name * = "locale.library";
VAR
base* : LocaleBasePtr;
(*-- Library Functions ------------------------------------------------*)
(*
** $VER: locale_protos.h 38.5 (18.6.93)
*)
(*--- functions in V38 or higher (Release 2.1) ---*)
LIBCALL (base : LocaleBasePtr) CloseCatalog *
( catalog [8] : CatalogPtr );
-36;
LIBCALL (base : LocaleBasePtr) CloseLocale *
( locale [8] : LocalePtr );
-42;
LIBCALL (base : LocaleBasePtr) ConvToLower *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: E.ULONG;
-48;
LIBCALL (base : LocaleBasePtr) ConvToUpper *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: E.ULONG;
-54;
LIBCALL (base : LocaleBasePtr) FormatDate *
( locale [8] : LocalePtr;
fmtTemplate [9] : ARRAY OF CHAR;
VAR date [10] : D.Date;
putCharFunc [11] : U.HookPtr );
-60;
LIBCALL (base : LocaleBasePtr) FormatString *
( locale [8] : LocalePtr;
fmtTemplate [9] : ARRAY OF CHAR;
dataStream [10] : E.APTR;
putCharFunc [11] : U.HookPtr )
: E.APTR;
-66;
LIBCALL (base : LocaleBasePtr) GetCatalogStr *
( catalog [8] : CatalogPtr;
stringNum [0] : LONGINT;
defaultString [9] : ARRAY OF CHAR )
: E.STRPTR;
-72;
LIBCALL (base : LocaleBasePtr) GetLocaleStr *
( locale [8] : LocalePtr;
stringNum [0] : E.ULONG )
: E.STRPTR;
-78;
LIBCALL (base : LocaleBasePtr) IsAlNum *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: BOOLEAN;
-84;
LIBCALL (base : LocaleBasePtr) IsAlpha *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: BOOLEAN;
-90;
LIBCALL (base : LocaleBasePtr) IsCntrl *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: BOOLEAN;
-96;
LIBCALL (base : LocaleBasePtr) IsDigit *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: BOOLEAN;
-102;
LIBCALL (base : LocaleBasePtr) IsGraph *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: BOOLEAN;
-108;
LIBCALL (base : LocaleBasePtr) IsLower *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: BOOLEAN;
-114;
LIBCALL (base : LocaleBasePtr) IsPrint *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: BOOLEAN;
-120;
LIBCALL (base : LocaleBasePtr) IsPunct *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: BOOLEAN;
-126;
LIBCALL (base : LocaleBasePtr) IsSpace *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: BOOLEAN;
-132;
LIBCALL (base : LocaleBasePtr) IsUpper *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: BOOLEAN;
-138;
LIBCALL (base : LocaleBasePtr) IsXDigit *
( locale [8] : LocalePtr;
character [0] : E.ULONG )
: BOOLEAN;
-144;
LIBCALL (base : LocaleBasePtr) OpenCatalogA *
( locale [8] : LocalePtr;
name [9] : ARRAY OF CHAR;
tags [10] : ARRAY OF U.TagItem )
: CatalogPtr;
-150;
LIBCALL (base : LocaleBasePtr) OpenCatalog *
( locale [8] : LocalePtr;
name [9] : ARRAY OF CHAR;
tags [10]..: U.Tag )
: CatalogPtr;
-150;
LIBCALL (base : LocaleBasePtr) OpenLocale *
( name [8] : ARRAY OF CHAR )
: LocalePtr;
-156;
LIBCALL (base : LocaleBasePtr) ParseDate *
( locale [8] : LocalePtr;
VAR date [9] : D.Date;
fmtTemplate [10] : ARRAY OF CHAR;
getCharFunc [11] : U.HookPtr )
: BOOLEAN;
-162;
LIBCALL (base : LocaleBasePtr) StrConvert *
( locale [8] : LocalePtr;
string [9] : ARRAY OF CHAR;
buffer [10] : E.APTR;
bufferSize [0] : E.ULONG;
type [1] : E.ULONG )
: E.ULONG;
-174;
LIBCALL (base : LocaleBasePtr) StrnCmp *
( locale [8] : LocalePtr;
string1 [9] : ARRAY OF CHAR;
string2 [10] : ARRAY OF CHAR;
length [0] : LONGINT;
type [1] : E.ULONG )
: LONGINT;
-180;
(*-- Library Base variable --------------------------------------------*)
(*-----------------------------------*)
PROCEDURE* CloseLib ();
BEGIN (* CloseLib *)
IF base # NIL THEN E.base.CloseLibrary (base) END
END CloseLib;
(*-----------------------------------*)
PROCEDURE OpenLib * (mustOpen : BOOLEAN);
BEGIN (* OpenLib *)
IF base = NIL THEN
base :=
SYS.VAL (
LocaleBasePtr,
E.base.OpenLibrary (name, E.libraryMinimum));
IF base # NIL THEN SYS.SETCLEANUP (CloseLib)
ELSIF mustOpen THEN HALT (100)
END;
END;
END OpenLib;
BEGIN
base := NIL
END Locale.